import "../../../../scss/activity/group_buy/group_detail_list.scss"
import $ from "jquery"
import Vue from "vue"
import com from "../../../utils/common"
import moment from "moment"
$(function () {

  let page = {
    _actid: com.getUrlParam("actid") ? com.getUrlParam("actid") : 1,
    _joinid: com.getUrlParam("joinid") ? com.getUrlParam("joinid") : 1,
    _app: {},

    _appData: {
      JoinerRank: [],
    },
    _init: function () {

      let self = this;
      com.ajax({
        url: "/act/groupby/getGroupDetail",
        data: {
          Actid: self._actid,
          Joinid: self._joinid,
        },
        ok: function (data) {
          console.log(data)
          if (data["msg"] == "ok") {

            let GroupDetail = [];
            GroupDetail.push({
              Name:data['leader'].Name,
              Mobile:data['leader'].Mobile,
              JoinDate:moment(data['leader'].CreateTime).format("YYYY-MM-DD HH:mm"),
              Identity:'head',
            })
            for (let i = 0; i < data['partners'].length; ++i) {
              GroupDetail.push({
                Name: data['partners'][i].Name,
                Mobile:data['partners'][i].Mobile,
                JoinDate: moment(data['partners'][i].CreateTime).format("YYYY-MM-DD HH:mm"),
                Identity: 'member',
              })
            }

            self._appData.GroupDetail = GroupDetail;
            self._loadTemp();
          } else {
            com.alertDialog('活动数据错误');
          }
        }
      })

    },
    _loadTemp: function () {
      let self = this;
      self._app = new Vue({
        el: "#app",
        data: self._appData,
        methods: {},
      })
    }
  }

  page._init()

})